package com.ruoyi.web.controller.applet;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.BdmSignIn;
import com.ruoyi.system.service.IBdmSignInService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 小程序签到Controller
 *
 * @author ruoyi
 * @date 2024-12-13
 */
@RestController
@RequestMapping("/applet/signin")
public class AppletSignInController extends BaseController
{
    @Autowired
    private IBdmSignInService bdmSignInService;

    /**
     * 查询签到列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BdmSignIn bdmSignIn)
    {
        startPage();
        List<BdmSignIn> list = bdmSignInService.selectBdmSignInList(bdmSignIn);
        return getDataTable(list);
    }

    /**
     * 获取签到详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bdmSignInService.selectBdmSignInById(id));
    }

    /**
     * 新增签到
     */
    @GetMapping
    public AjaxResult addSignIn()
    {
        return success(bdmSignInService.insertBdmSignIn());
    }

    /**
     * 修改签到
     */
    @PutMapping
    public AjaxResult edit(@RequestBody BdmSignIn bdmSignIn)
    {
        return toAjax(bdmSignInService.updateBdmSignIn(bdmSignIn));
    }

    /**
     * 删除签到
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bdmSignInService.deleteBdmSignInByIds(ids));
    }

    /**
     * 我的积分查询
     * @return
     */
    @GetMapping("/mineScore")
    public AjaxResult mineScore() {
        return success(bdmSignInService.selectMineScore());
    }
}
